-
Notifications
You must be signed in to change notification settings - Fork 176
fix 500 error page being cached #590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be related at all w/ the one user on discord having a random session leak?
It's probably it's error yeah. I need to investigate this more closely but based on what he describes it is likely the issue. |
|
Yea I'm not sure what the use case would be for errors to be cached. The HTTP spec says not to cache 500's. |
There is a use case that i can think of. Just to reduce the load on the server when you know that something is broken, you could cache the error for a small amount of time. |
cf6c3dc to
3d253bb
Compare
|
this is interesting, probably what that guy was experiencing. i like the idea of having an environment variable to opt out of it. would be nice to know why |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just 1 question on the statuCodes
It seems that sometimes the 500 error page gets cached for some reason.
We don't want that to happen.
Update:
This can happen for page router if your 500 (or 404) page use
getStaticProps.For every route in page router that throws an exception, the cache-control gets overwritten and set as if it was an SSG route. The problem is that it doesn't remove the previous header that was set (including set-cookie). This could lead to session leakage.
Haven't tested in Next 15, this is probably fixed there since they don't override your cache-control anymore ( It might still happen if you don't set any cache-control for the route )
I added an env variable
OPEN_NEXT_DANGEROUSLY_SET_ERROR_HEADERSthat if set to true will disable the cache-control override that we do